package Intercepting;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author:CJJ
 * 创建过滤器链
 */
public class FilterChain {
 private List<Filter> filters =  new ArrayList<Filter>();
 private Target target;
    private String request;

    public void addFilter(Filter filter)
 {
	 filters.add(filter);
 }

 public void execute(String request)
 {
	 for(Filter filter : filters)
	 {
		 filter.execute(request);
	 }
	 target.execute(request);
 }

 public void setTarget(Target target)
 {
	 this.target = target;
 }

    public void filterRequest(String request) {
     this.request = request;
    }
}
